<template>
  <header class="layout-header">
    <div class="page-name">
      <h5>{{ pageName }}</h5>
    </div>
    <div class="header-btns">
      <a-space>
        <a-button @click="handlePreview">预览</a-button>
        <a-button>取消</a-button>
        <a-button type="primary" icon="cloud-download" @click="handleSave">
          保存
        </a-button>
      </a-space>
    </div>
  </header>
</template>

<script>
export default {
  name: "",
  props: {},
  data() {
    return {};
  },
  watch: {},
  computed: {
    pageName() {
      let page = this.$diyObser.store.currentPage;
      return page?.page_name ? page.page_name : "";
    },
  },
  methods: {
    // 跳转至全渠道商城后台
    gotoAdminFrontEnd() {
      window.location.href = `${window.location.protocol}//${window.location.host}/admin/#/dashboard/analysis`;
    },
    // 点击预览
    handlePreview() {
      this.$emit("handlePreview");
    },
    // 点击保存
    handleSave() {
      this.$emit("handleSave");
    },
  },
};
</script>

<style lang="scss" scoped>
.layout-header {
  width: 100%;
  height: 54px;
  background: #ffffff;
  box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.16);
  overflow: hidden;
  z-index: 501;
  .page-name {
    height: 100%;
    display: flex;
    align-items: center;
    color: #000000;
    float: left;
    padding-left: 14px;
    .goback {
      cursor: pointer;
      display: flex;
      align-items: center;
      .icon-back {
        width: 12px;
        height: 12px;
        margin-right: 10px;
      }
      h4 {
        font-size: 16px;
        font-weight: 600;
        margin: 0;
        padding: 0;
      }
    }

    span {
      width: 0px;
      height: 20px;
      border: 1px solid #707070;
      opacity: 0.2;
      margin: 0 20px;
    }
    h5 {
      font-size: 14px;
      font-weight: 400;
      margin: 0;
      padding: 0;
    }
  }

  .header-btns {
    float: right;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    height: 100%;
    padding-right: 14px;
  }
}
</style>
